//
//  DCLabelAndTextLabel.m
//  Driver
//
//  Created by 大橙子 on 2018/11/6.
//  Copyright © 2018 Tomous. All rights reserved.
//

#import "DCLabelAndTextLabel.h"
@interface DCLabelAndTextLabel ()

@end
@implementation DCLabelAndTextLabel
-(instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        
        self.titleLabel = [[UILabel alloc]init];
        self.titleLabel.textAlignment = NSTextAlignmentRight;
        [self addSubview:self.titleLabel];
        
        self.textField = [[UITextField alloc]init];
        self.textField.clearButtonMode = UITextFieldViewModeWhileEditing;
        self.textField.textAlignment = NSTextAlignmentCenter;
        [self addSubview:self.textField];
        
        self.line = [[UIView alloc]init];
        self.line.backgroundColor = [UIColor lightGrayColor];
        self.line.alpha = 0.8;
        [self addSubview:self.line];
        
    }
    return self;
}
-(void)layoutSubviews
{
    [super layoutSubviews];
    self.titleLabel.frame = CGRectMake(0, 0, 120*WIDTHSCALE6, self.height);
    self.textField.frame = CGRectMake(self.titleLabel.right+10, 0, self.width - self.titleLabel.width-10, self.height-1);
    self.line.frame = CGRectMake(self.textField.x, self.textField.bottom, self.textField.width, 1);
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
